﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PracticeChart.Popups
{
    public partial class Times : Form
    {
        // attributes
        Main mainChart;
        public Times()
        {
            InitializeComponent();
        }
        public Times(String[] dates, String[] times, Main c)
        {
            InitializeComponent();
            
            // save chart
            mainChart = c;

            // load dates
            onsetDate.Text = dates[0];
            dispatchedDate.Text = dates[1];
            enrouteDate.Text = dates[2];
            onsceneDate.Text = dates[3];
            atpatientDate.Text = dates[4];
            deprefDate.Text = dates[5];
            arcrecDate.Text = dates[6];
            xfercareDate.Text = dates[7];
            availableDate.Text = dates[8];
            
            // load times
            onsetTime.Text = times[0];
            dispatchedTime.Text = times[1];
            enrouteTime.Text = times[2];
            onsceneTime.Text = times[3];
            atpatientTime.Text = times[4];
            deprefTime.Text = times[5];
            arcrecTime.Text = times[6];
            xfercareTime.Text = times[7];
            availableTime.Text = times[8];
        }

        private void saveButton_Click(object sender, EventArgs e)
        {
            mainChart.onsetLabel.Text = onsetDate.Text + " " + onsetTime.Text;
            mainChart.dispatchedLabel.Text = dispatchedDate.Text + " " + dispatchedTime.Text;
            mainChart.enrouteLabel.Text = enrouteDate.Text + " " + enrouteTime.Text;
            mainChart.onsceneLabel.Text = onsceneDate.Text + " " + onsceneTime.Text;
            mainChart.atpatientLabel.Text = atpatientDate.Text + " " + atpatientTime.Text;
            mainChart.deprefLabel.Text = deprefDate.Text + " " + deprefTime.Text;
            mainChart.arcrecLabel.Text = arcrecDate.Text + " " + arcrecTime.Text;
            mainChart.xfercareLabel.Text = xfercareDate.Text + " " + xfercareTime.Text;
            mainChart.availableLabel.Text = availableDate.Text + " " + availableTime.Text;
            this.Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
